/*
    数组练习，从键盘7个二进制数位，计算出奇偶校验位，并把所有二进制位打印在屏幕上
*/
#include <stdio.h>
int main() {
    int arr[8], num = 0, i = 0, num1 = 0;
    printf("请输入七个二进制数位：");
    for (num = 0; num <= 6; num++) {
        scanf("%d",&arr[num]);
	if (arr[num] == 1) {
	    i++;
   	}
    }
    for (num1 = 0 ; num1 < 7; num1++) {
    	printf("%d",arr[num1] );
    }
    if (!(i % 2)) {
	printf("%d", arr[7] = 0);
    }
    else {
	printf("%d", arr[7] = 1);
    }
    printf("\n");
    return 0;
}
